<?php
// config DB here 

$db_staf_attnd = "staf_attnd";
$dbname = "guestbook";
$dbuser = "postgres";
$dbhost = "localhost";
$dbport = "5432";
$dbpass = "genpass";

$dbnameMIS = "matrik2006/2007";
$dbuserMIS = "pgsql";
$dbhostMIS = "10.10.30.6";
$dbportMIS = "5432";
$dbpassMIS="";

function db_connect() {
	global $dbname,$dbuser,$dbhost,$dbport,$dbpass;
	return pg_connect("host=$dbhost port=$dbport dbname=$dbname user=$dbuser password=$dbpass");
}


function db_connectMIS() {
	global $dbnameMIS,$dbuserMIS,$dbhostMIS,$dbportMIS,$dbpassMIS;
	return pg_connect("host=$dbhostMIS port=$dbportMIS dbname=$dbnameMIS user=$dbuserMIS password=$dbpassMIS");
}

function check_ic($ic){
	
	$sql = "SELECT ic_new from pelawat_profiles WHERE ic_new = '$ic'";
	//echo $sql;exit;
	$res = pg_query($sql);
	$num = pg_num_rows($res);
	if($num == 0) $penah_datang = 'F';
	if($num != 0) $penah_datang = 'T';
	
	return $penah_datang;
	//return $sql;
}

function html_menu(){
?>
<table border="0" cellpadding="2" cellspacing="2" align="center">
  <!--DWLayoutTable-->
  <tr>
    <td width="590" height="100" valign="top">
		<input name="home" type="button" class="btn100x502" id="home" value="HOME" onclick="window.location = '/mykad_0.0.2a/ '"><br /><br />
    	<input name="manin" type="button" class="btn100x502" id="manin" value="MANUAL INPUT" onclick="window.location = '/mykad_0.0.2a/visitor.php?act=new'">
	</td>
  </tr>
</table>
<?php
}

function menu_atas(){
?>
<table width="600" border="0" align="center">
  <tr>
    <td><div align="center">Report</div></td>
  </tr>
</table>
<?php
}


db_connect();
?>
